<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">



    <title>欢迎注册_飞华健康网</title>

    <meta name="description" content="欢迎注册_飞华健康网" />



    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

    <meta content="always" name="referrer">

    <link href="css/register.css" rel="stylesheet" type="text/css" />

    <link rel="shortcut icon" href="//static.fh21.com.cn/images/favicon.ico" type="image/x-icon" />

    <meta property="qc:admins" content="24062170223072466021637563675352747716" />

    <script type="text/javascript" src="js/jquery.min.js"></script>

    <script type="text/javascript" src="js/common.js"></script>

    <script type="text/javascript" src="js/ysHeader_v2.js"></script>





</head>

<body>



<!--页面头部区域开始-->

<div class="header">

    <div class="headerwrap">

        <ul class="head01">

            <a href="http://www.fh21.com.cn"><!--飞华健康网--></a>

        </ul>

        <ul class="head02">

            欢迎注册

        </ul>

        <ul class="head03">

            <a href="http://www.fh21.com.cn">返回首页</a>

        </ul>

    </div>

</div>

<!--页面头部区域结束-->





<div class="main_content reg02" style="padding-top:30px;">

    <!--页面tab-->

    <div class="reg_tag">

        <ol></ol>

        <ul>

            <li class="curr regTab" linked="userReg">用户注册</li>

            <li class="regTab" linked="doctorReg" id="doctorTab">医生注册</li>

        </ul>

    </div>

    <!--普通用户注册-->

    <div class="reg02a regContent" id="userReg">

        <form id="reg_form" action="" method="post">

            <dl>

                <dt><span>*</span>用<em style="padding:0 7px;">户</em>名&nbsp;:</dt>

                <dd>

                    <ul  class="reg01a">

                        <input  name="username" id="username" type="text" value="" />

                    </ul>

                    <div  id="username_recommend" class="reg06" style="display:none;">

                    </div>

                    <div class="reg_tip " id="username_point" style="display:none;">

                        <p></p>

                        <ul>

                            请输入用户名

                        </ul>

                    </div>

                    <ul class="reg02a2">

                        4-14位字母、数字、下划线，开头为英文字符，设定后不可更改

                    </ul>

                </dd>

                <ol class="clearfloat">

                </ol>

            </dl>

            <dl>

                <dt><span>*</span>密<em style="padding-left:28px;">码</em>&nbsp;:</dt>

                <dd>

                    <ul class="reg01a">

                        <input name="password" id="password" type="password" value="" />

                    </ul>

                    <div class="reg_tip reg_tip_no" id="password_point" style="display:none;">

                        <p></p>

                        <ul>



                        </ul>

                    </div>

                    <ul class="reg02a2">

                        限用英文字母、数字和下划线，英文字母区分大小写，密码长度为6-16位

                    </ul>

                </dd>

                <ol class="clearfloat">

                </ol>

            </dl>

            <dl>

                <dt><span>*</span>确认密码&nbsp;:</dt>

                <dd>

                    <ul class="reg01a">

                        <input id="repeat_password" name="repeat_password" type="password" value="" />

                    </ul>

                    <div class="reg_tip " id="repeat_password_point" style="display:none;">

                        <p></p>

                        <ul>



                        </ul>

                    </div>

                    <ul class="reg02a2">

                        与登录密码输入一致

                    </ul>

                </dd>

                <ol class="clearfloat">

                </ol>

            </dl>

            <dl>

                <dt><span>&nbsp;</span>手<em style="padding:0 7px;">机</em>号&nbsp;:</dt>

                <dd>

                    <ul class="reg01a">

                        <input id="mobile" name="mobile" type="text" value="" />

                    </ul>

                    <div id="mobile_msm" class="reg02a3" id="" style="display:none;">

                        <ul class="reg01a">

                            <input name="code" id="code" type="text" value="" />

                        </ul>

                        <input id="send_mobile" name="" type="button" class="input01" onfocus="this.blur();" style="display:;" />

                        <p id="show_time" style="display:none;">120秒</p>



                        <div class="reg_tip " id="mobile_points" style="display:none;top:57px;">

                            <ul>

                            </ul>

                        </div>



                    </div>

                    <div class="reg_tip " id="mobile_point" style="display:none;">

                        <p></p>

                        <ul>



                        </ul>

                    </div>

                    <ul class="reg02a2">

                        设定后可用手机号登录，提问有回答会免费给您发短信

                    </ul>

                </dd>

                <ol class="clearfloat">

                </ol>

            </dl>

            <dl class="reg02a1">

                <dt><span>*</span>验<em style="padding:0 7px;">证</em>码&nbsp;:</dt>

                <dd>

                    <ul class="reg01a">

                        <input name="captcha" maxlength="4"  id="captcha" type="text" value="" />

                    </ul>

                    <ul class="reg02a4">

                        <img id="yw0" src="other/create?width=80&height=30&length=4&time=1511836689" />

                    </ul>

                    <div class="reg_tip " id="captcha_point" style="display:;">

                        <p style="margin-left:-170px;"></p>

                        <ul>



                        </ul>

                    </div>

                </dd>

                <ol class="clearfloat">

                </ol>

            </dl>

            <dl style="margin-bottom:0;">

                <dt>&nbsp;</dt>

                <dd>

                    <ul class="reg02a5">

                        <input id="clause" name="" type="checkbox" value="" checked="checked" />

                        我已经阅读并理解和接受 《<a target="_blank" href="http://www.fh21.com.cn/company/law.htm" class="link01">网站隐私保护条款</a>》

                    </ul>

                </dd>

                <ol class="clearfloat">

                </ol>

            </dl>

            <dl style="margin-bottom:0;">

                <dt>&nbsp;</dt>

                <dd>

                    <ul class="reg02a6">

                        <input id="reg_submit" name="" type="button" class="reg_btn01" value="" onfocus="this.blur();" onmouseover="this.className='reg_btn01 reg_btn01_over'" onmouseout="this.className='reg_btn01'" />

                    </ul>

                </dd>

                <ol class="clearfloat">

                </ol>

            </dl>

        </form>

    </div>

    <!--医生用户注册-->

    <div class="reg02a regContent" id="doctorReg" style="display:none;">

        <form id="doctorreg_form" action="" method="post">

            <input type="hidden" name="recommenduid" id="recommenduid" value="" />

            <input type="hidden" name="recommendtype" id="recommendtype" value="" />

            <dl>

                <dt><span>*</span>用<em style="padding:0 7px;">户</em>名&nbsp;:</dt>

                <dd>

                    <ul class="reg01a"><input name="username" id="doctorname" type="text" value="" /></ul>

                    <div id="doctorname_recommend" class="reg06" style="display:none;"></div>

                    <div class="reg_tip"  id="doctorname_point" style="display:none;"><p></p><ul></ul></div>

                    <ul class="reg02a2">4-14位字母、数字、下划线，开头为英文字符，设定后不可更改</ul>

                </dd>

                <ol class="clearfloat"></ol>

            </dl>

            <dl>

                <dt><span>*</span><span>&nbsp;</span>手<em style="padding:0 7px;">机</em>号&nbsp;:</dt>

                <dd>

                    <ul class="reg01a"><input id="doctormobile" name="mobile" type="text" value="" /></ul>

                    <div class="reg02a3" id="mobile_msm">

                        <ul class="reg01a"> <input name="code" id="doctorcode" type="text" value="" /></ul>

                        <input id="doctor_send_mobile" name="" type="button" class="input01" onfocus="this.blur();" style="display:;" />

                        <p id="doctor_show_time" style="display:none;">120秒</p>

                        <div class="reg_tip " id="doctor_mobile_points" style="display:none;top:57px;"><ul></ul></div>

                    </div>

                    <div class="reg_tip " id="doctormobile_point" style="display:none;"><p></p><ul></ul></div>

                    <ul class="reg02a2">请输入手机号，以便于找回密码</ul>

                </dd>

                <ol class="clearfloat"></ol>

            </dl>

            <dl>

                <dt><span>*</span>登录密码&nbsp;:</dt>

                <dd>

                    <ul class="reg01a"><input name="password" id="doctorpassword" type="password" value="" /></ul>

                    <ul class="reg02a2">限用英文字母、数字和下划线，英文字母区分大小写，密码长度为6-16位</ul>

                    <div class="reg_tip reg_tip_no" id="doctorpassword_point" style="display:none;"><p></p> <ul></ul></div>

                </dd>

                <ol class="clearfloat"></ol>

            </dl>

            <dl style="margin-bottom:0;">

                <dt>&nbsp;</dt>

                <dd>

                    <ul class="reg02a5"><input id="doctorclause" name="" type="checkbox" value="" checked="checked" />我已经阅读并理解和接受 《<a target="_blank" href="http://www.fh21.com.cn/company/law.htm" class="link01">网站隐私保护条款</a>》</ul>

                </dd>

                <ol class="clearfloat"></ol>

            </dl>

            <dl style="margin-bottom:0;">

                <dt>&nbsp;</dt>

                <dd>

                    <ul class="reg02a6"><input id="doctorreg_submit" name="" type="button" class="reg_btn01" value="" onfocus="this.blur();" onmouseover="this.className='reg_btn01 reg_btn01_over'" onmouseout="this.className='reg_btn01'" /></ul>

                </dd>

                <ol class="clearfloat"></ol>

            </dl>

        </form>

    </div>

    <!--右侧-->

    <div class="reg07b" style="margin-top:-35px;">

        <p><span>如果您已有账号，请</span><a href="/user/login"></a></p>

        <img src="images/attention.png" />

    </div>

    <ul class="clearfloat">

    </ul>

</div>







<!-- 引入验证码文开始件 -->

<script type="text/javascript" charset="utf-8">
    window.mobilecheck = function() {
        var check = false;
        (function(a){
            if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))
            {check = true;}
        })(navigator.userAgent||navigator.vendor||window.opera);
        return check; }
    var cssUrl = FHUrls.statics + "/css/verify/verify_pc.css";
    if(mobilecheck()){
        var cssUrl = FHUrls.statics + "/css/verify/verify.css";
    }
    var links = $("head").find('link[href="' + cssUrl + '"]');
    if (links.length == 0) {
        //"insert css file"
        var cssfile = $("<link/>", {
            "href" : cssUrl,
            "type" : "text/css",
            "rel" : "stylesheet"
        });
        var cssFiles = $("head").find('link[type="text/css"]');
        var jsFiles = $("head").find("script[type='text/javascript']");
        if (cssFiles.length != 0) {
            //考虑到 没有css 文件
            cssFiles.last().after(cssfile);
        } else if (jsFiles.length != 0) {
            //考虑到 没有js 文件
            jsFiles.first().before(cssfile);
        } else {
            $("head").append(cssfile);
        }
        //"insert css file" end
    }
</script>
<div id="overlay_verify" style="display:none;">
    <div id="overlay_verify_bg"> </div>
    <div class="win_open100 win0001" id="wrapper" >
        <ul>
            <!--  contenteditable="true"  onkeyup="console.log(value=value.replace('/^\w+$/'))" 解决浏览器兼容 -->
            <input maxlength="4" id="inputy_verify" name="" type="text" class="input01 validateCode" placeholder="请输入右侧的验证码" value="请输入右侧的验证码" />
            <img id="change_verify_show" class="change_verify"  style="position: absolute; left: 200px; _left: 184px;top: 0; width: 60px; height: 42px;" />
            <img class="codeCorrect" src="images/icon_yes.png" style="display: none;" /><!-- 验证码正确-->
            <img class="codeError" src="//static.fh21.com.cn/images/iask/wap/icon_no.png" style="display: none;" /><!-- 验证码错误-->
        </ul>
        <div class="control">
            <input id="submit_verify" type="button" name="name" value="确定" class="btn confirm" disabled="disabled" />
            <input type="button" name="name" value="取消" class="btn cancle" />
        </div>
    </div>
</div>
<script type="text/javascript">
    var validateDefault = "请输入右侧的验证码";
    $(function () {
        //文本框默认值的变化
        $("#inputy_verify").focusin(function (e) {
            e.stopPropagation();
            if ($(this).val() == validateDefault) {
                $(this).val("").removeClass("blur").addClass("focus");
            } else {
                $(this).removeClass("blur").addClass("focus");
            }
        }).focusout(function (e) {
            e.stopPropagation();
            if ($(this).val() == 0) {
                $(this).val(validateDefault).removeClass("focus").addClass("blur");
            } else {
                $(this).removeClass("blur").addClass("focus");
            }
            if($("#inputy_verify").val() == validateDefault){
                controler_css();
            }
        });
        //触发验证
        $("#inputy_verify").keyup(function () {
            var code = $.trim($(this).val());
            if (code.length >= 1) {//输入1个字符时，触发验证
                verifyCaptcha($.trim($('#inputy_verify').val()), function() {
                    //正确
                    $("#submit_verify").attr('disabled',false);
                    $(".codeCorrect").show();
                    $(".codeError").hide();
                }, function(statusCode) {
                    var error = '验证码错误';
                    if(statusCode === 10001) {
                        error = '验证码不能为空';
                    } else if(statusCode === 10002) {
                        error = '验证码错误';
                    }
                    //错误
                    controler_css();
                    $(".codeCorrect").hide();
                    $(".codeError").show();
                }, 'sendmessage');
            } else {
                controler_css();
            }
        });
        //取消(关闭弹层)
        $(".cancle").click(function () {
            closeWindow();
        });
    });
    /**
     * 验证验证码
     *
     * @param code		验证码
     * @param success	验证成功的回调函数
     * @param failure	验证失败的回调函数
     */
    function verifyCaptcha(code, success, failure, key) {
        // 解析参数
        var code 	= code;
        var success = typeof(success) == 'function' ? success : function() {};
        var failure = typeof(failure) == 'function' ? failure : function() { alert('验证码错误'); };
        var key     = key ? key : 'captchacode';

        // 错误代码
        var captcha_is_null  = 10001;
        var captcha_validate = 10002;
        var captcha_error    = 10003;

        // 验证验证码
        if(code === '') {
            failure(captcha_is_null);
            // } else if(!/^\w+$/.test(code)) {
        } else if(code.length < 2) {
            failure(captcha_validate);
        } else {
            $.getJSON(FHUrls.widget + '/captcha/verify?callback=?', {code: code, key: key}, function(response) {
                if(response.errno) {
                    failure(captcha_error);
                } else {
                    success();
                }
            });
        }
    }
    //验证码换一换
    $(".change_verify").click(function(){
        changeVerify();
    });
    //取消(关闭弹层)
    function closeWindow(){
        $("#inputy_verify").val(validateDefault).removeClass("focus").addClass("blur");
        controler_css();
        $("#overlay_verify,#wrapper").hide();
    }
    //控制样式显示,确定按钮不可点击
    function controler_css(){
        $(".codeCorrect").hide();
        $(".codeError").hide();
        $("#submit_verify").attr('disabled','disabled');
    }
    //验证码更换
    function changeVerify(){
        $(".change_verify").attr('src', "//widget.fh21.com.cn/captcha/create?width=80&height=30&length=4&key=sendmessage&time="+Date.parse(new Date()));
        if($("#inputy_verify").val() != validateDefault){
            $(".codeError").show();
        }
        $("#submit_verify").attr('disabled','disabled');
    }

</script>


<!-- 引入验证码文件结束 -->

</body>

</html>



<script>

    /* 普通用户注册验证 */

    var reg_check = {

        init: function(){

            reg_check.bind_event('username');

            reg_check.bind_event('password');

            reg_check.bind_event('repeat_password');

            reg_check.bind_event('mobile');

            reg_check.bind_event('captcha');

            reg_check.bind_event('code');

            reg_check.bind_fu();



            if($('#mobile').val() !=''){

                $('#mobile_msm').fadeIn();

            } else {

                $('#mobile_msm').fadeOut();

            };

            $("#reg_submit").click(function(){

                reg_check.reg_submit();

                return false;

            });

        },



        //推荐关闭

        bind_fu:function(){

            $(document).on('click','#close',function(){

                $('#username_recommend').fadeOut();

            });

            $(document).on('click','.username_recommend',function(){

                $('#username').val($(this).val());

                $('#username_recommend').fadeOut();

                $('#username_point').removeClass('reg_tip_no');

                $('#username_point').addClass('reg_tip_yes').show().children('ul').hide();

            });

        },



        bind_event: function (id_name){

            $("#"+id_name).focus(function(){

                $(this).parent().addClass('curr');

                $('#'+id_name+'_point').hide();

                reg_check.check_focus(id_name);

            }).blur(function(){

                $(this).parent().removeClass('curr');

                eval('reg_check.check_'+id_name+'()');

            });

        },

        //检查手机验证

        check_code:function(id_name){

            return true;

        },

        //检查手机聚焦事件

        check_focus:function(id_name){

            if(id_name == 'mobile'){

                $('#mobile_msm').fadeIn();

            }

        },

        //用户名检测

        check_username: function (){

            var fale = true;

            var username = $.trim($('#username').val());

            if($.trim(username) == ''){

                $('#username_point').addClass('reg_tip_no').show().children('ul').show().html('用户名不能为空');

                return fale = false;

            }

            if((/^[a-zA-Z][a-zA-Z0-9_]{3,13}$/ && /\s/ ).test(username)){

                $('#username_point').addClass('reg_tip_no').show().children('ul').show().html('4-14位字母、数字或下划线');

                return fale = false;

            }

            var url = '/user/validateusername';

            $.ajax({type:'post',url:url,dataType:'json',async:false,

                data:{username:username},

                success: function(json){

                    if(json.errno == 0){

                        $('#username_point').removeClass('reg_tip_no');

                        $('#username_point').addClass('reg_tip_yes').show().children('ul').hide();

                        $('#username_recommend').fadeOut();

                        return fale = true;

                    }else if(json.errno == 10203){

                        $('#username_point').addClass('reg_tip_no').show().children('ul').show().html('用户名已被占用');

                        var urecommend_html = reg_check.username_recommend(username);

                        $('#username_recommend').html(urecommend_html).fadeIn();

                        return fale = false;

                    }else if(json.errno == 10204){

                        $('#username_point').addClass('reg_tip_no').show().children('ul').show().html('4-14位字母、数字或下划线');

                        return fale = false;

                    }

                }

            });

            return fale;

        },

        //密码检测

        check_password: function (){

            var fale = true;

            var password=$.trim($('#password').val());

            if($.trim(password) == ''){

                $('#password_point').addClass('reg_tip_no').show().children('ul').show().html('密码不能为空');

                return fale = false;

            }

            if(!(/^[0-9a-zA-Z_]+$/).test(password)){

                $('#password_point').addClass('reg_tip_no').show().children('ul').show().html('限用英文字母、数字和下划线');

                return fale = false;

            }

            //密码由6-16位字母、数字或下划线组成

            if(!password.match(/^[\w]{6,16}$/)){



                $('#password_point').addClass('reg_tip_no').show().children('ul').show().html('密码由6-16位字符组成');

                return fale = false;

            }



            $('#password_point').removeClass('reg_tip_no');

            $('#password_point').addClass('reg_tip_yes').show().children('ul').hide();



            return fale;

        },

        //确认密码检测

        check_repeat_password: function (){

            var fale = true;

            var password = $.trim($('#password').val()),

                repeat_password = $.trim($('#repeat_password').val());

            if($.trim(repeat_password) == ''){

                $('#repeat_password_point').addClass('reg_tip_no').show().children('ul').show().html('确认密码不能为空');

                return fale = false;

            }

            if(password != repeat_password){

                $('#repeat_password_point').addClass('reg_tip_no').show().children('ul').show().html('两次输入的密码不一致');

                return fale = false;

            }

            $('#repeat_password_point').removeClass('reg_tip_no');

            $('#repeat_password_point').addClass('reg_tip_yes').show().children('ul').hide();

            return fale;

        },

        //手机号码检测

        check_mobile: function (){

            var fale = true;

            var mobile = $.trim($('#mobile').val());

            var check_mobile = /^1[3|4|5|8|9|7][\d]{9}$/;

            if(mobile !=''){

                if(!check_mobile.exec(mobile)){

                    $('#mobile_point').addClass('reg_tip_no').show().children('ul').show().html('手机号码格式不正确');

                    return fale = false;

                }

                $('#mobile_point').removeClass('reg_tip_no').hide();

                $('#captcha').parents("dl.reg02a1").addClass("removed").hide();

            }

            if($('#mobile').val() == ''){

                $('#mobile_msm').fadeOut();

                $('#mobile_point').removeClass('reg_tip_no').hide();

                $('#captcha').parents("dl.reg02a1").removeClass("removed").show();

            }

            return fale;

        },

        //验证码检测

        check_captcha: function (){

            var fale = true;

            //发送成功手机验证码

            if($('#captcha').parents("dl.reg02a1").hasClass("removed")){

                return true;

            }

            var captcha = $.trim($('#captcha').val());

            if($.trim(captcha) == ''){

                $('#captcha_point').addClass('reg_tip_no').show().children('ul').show().html('验证码不能为空');

                return fale = false;

            }

            // if(!captcha.match(/^[a-z|0-9]{4}$/i)){

            if(captcha.length < 2){

                $('#captcha_point').addClass('reg_tip_no').show().children('ul').show().html('验证码错误');

                return fale = false;

            }

            var url = '/user/validatecode';

            $.ajax({type:'post',url:url,dataType:'json',async:false,

                data:{code:captcha},

                success: function(json){

                    if(json.errno == 0 ){

                        $('#captcha_point').removeClass('reg_tip_no');

                        $('#captcha_point').addClass('reg_tip_yes').show().children('ul').hide();

                        return fale = true;

                    }else if(json.errno == 10207){

                        $('#captcha_point').addClass('reg_tip_no').show().children('ul').show().html('验证码错误');

                        return fale = false;

                    }

                }

            });

            return fale;

        },

        //用户名推荐

        username_recommend:function(username){

            if(username ==''){

                return false;

            }

            var username_recommend_html = '';

            var url = '/public/usernamerecommend';

            $.ajax({type:'post',url:url,dataType:'json',async:false,

                data:{username:username},

                success: function(json){

                    if(json.errno == 0 ){

                        username_recommend_html = '<ol>选择推荐用户名：<img id="close" title="关闭" src="images/close03.gif"></ol>';

                        $.each(json.username_list, function(index, val) {

                            username_recommend_html+='<ul><input class="username_recommend" value="'+val+'" type="radio" name="username_recommend">'+val+'</ul>';

                        });

                    }

                }

            });

            return username_recommend_html;

        },

        check_clause:function(){

            var fale = true;

            if(!$("#clause").prop("checked")){

                if(confirm("是否接受飞华健康网《网站隐私保护条款》?")){

                    $("#clause").prop('checked',true);

                } else {

                    return fale = false;

                }

            }

            return fale;

        },

        reg_submit:function(){

            var check_result = true;

            var check_error = [];

            check_error[0] = reg_check.check_clause();

            check_error[1] = reg_check.check_username();

            check_error[2] = reg_check.check_password();

            check_error[3] = reg_check.check_repeat_password();

            check_error[4] = reg_check.check_mobile();

            check_error[5] = reg_check.check_captcha();

            for(var i in check_error){

                if(!check_error[i]){

                    check_result = false;

                }

            }

            if(check_result){

                var url = '/user/checkreg';

                var username = $.trim($("#username").val());

                var password = $.trim($("#password").val());

                var captcha = $.trim($("#captcha").val());

                var repeat_password = $.trim($("#repeat_password").val());

                var mobile = $.trim($("#mobile").val());

                var code = $.trim($("#code").val());



                var sendData={username:username,password:password,repeat_password:repeat_password,mobile:mobile,code:code,return_url:""};

                if(!$('#captcha').parents("dl.reg02a1").hasClass("removed")){

                    sendData.captcha=captcha;

                }

                $.ajax({type:'post',url:url,dataType:'json',async:false,

                    data:sendData,

                    complete: function(){

                        $("#reg_submit").attr('disabled',false);

                    },

                    beforeSend: function(){

                        $("#reg_submit").attr('disabled','disabled');

                    },

                    success: function(json){

                        if(json.errno == 0 ){



                            location.href = '/public/regestersuccess';

                        }else if(json.errno == 10207){

                            $('#mobile_points').addClass('reg_tip_no').show().children('ul').show().html('手机验证码不正确');

                            return false;

                        }else if(json.errno == 10210){

                            $('#mobile_point').addClass('reg_tip_no').show().children('ul').show().html('手机号码错误');

                            return false;

                        }else if(json.errno == 10205){

                            $('#password_point').addClass('reg_tip_no').show().children('ul').show().html('密码输入有误');

                            return false;

                        }else if(json.errno == 10206){

                            $('#password_point').addClass('reg_tip_no').show().children('ul').show().html('确认密码输入有误');

                            return false;

                        }else if(json.errno == 10200){

                            $('#mobile_point').addClass('reg_tip_no').show().children('ul').show().html('手机号码已存在');

                            return false;

                        }else if(json.errno == 10204){

                            $('#username_point').addClass('reg_tip_no').show().children('ul').show().html('用户名由4-14位字母、数字或下划线组成');

                            return false;

                        } else {

                            alert('网络延时，请稍后再试');

                            return false;

                        }

                    }

                });

            }

        }

    }

    reg_check.init();



    /* 医生用户注册验证 */

    var doctorreg_check = {

        init: function(){

            doctorreg_check.bind_event('doctorname');

            doctorreg_check.bind_event('doctorpassword');

            doctorreg_check.bind_event('doctormobile');

            doctorreg_check.bind_fu();



            $("#doctorreg_submit").click(function(){

                doctorreg_check.reg_submit();

                return false;

            });

        },

        bind_event: function (id_name){

            $("#"+id_name).focus(function(){

                $(this).parent().addClass('curr');

                $('#'+id_name+'_point').hide();

            }).blur(function(){

                $(this).parent().removeClass('curr');

                eval('doctorreg_check.check_'+id_name+'()');

            });

        },

        //推荐关闭

        bind_fu:function(){

            $(document).on('click','#closedoctor',function(){

                $('#doctorname_recommend').fadeOut();

            });

            $(document).on('click','.doctorname_recommend',function(){

                $('#doctorname').val($(this).val());

                $('#doctorname_recommend').fadeOut();

                $('#doctorname_point').removeClass('reg_tip_no').addClass('reg_tip_yes').show().children('ul').hide();

            });

        },

        //检查手机验证

        check_code:function(id_name){

            return true;

        },

        //用户名检测

        check_doctorname: function (){

            var fale = true;

            var username = $.trim($('#doctorname').val());

            if($.trim(username) == ''){

                $('#doctorname_point').addClass('reg_tip_no').show().children('ul').html('用户名不能为空');

                return fale = false;

            }

            if((/^[a-zA-Z][a-zA-Z0-9_]{3,13}$/ && /\s/ ).test(username)){

                $('#doctorname_point').addClass('reg_tip_no').show().children('ul').html('4-14位字母、数字或下划线');

                return fale = false;

            }

            var url = '/user/validateusername';

            $.ajax({type:'post',url:url,dataType:'json',async:false,

                data:{username:username},

                success: function(json){

                    if(json.errno == 0){

                        $('#doctorname_point').removeClass('reg_tip_no');

                        $('#doctorname_point').addClass('reg_tip_yes').show().children('ul').hide();

                        $('#doctorname_recommend').fadeOut();

                        return fale = true;

                    }else if(json.errno == 10203){

                        $('#doctorname_point').addClass('reg_tip_no').show().children('ul').html('用户名已被占用');

                        var urecommend_html = doctorreg_check.username_recommend(username);

                        $('#doctorname_recommend').html(urecommend_html).fadeIn();

                        return fale = false;

                    }else if(json.errno == 10204){

                        $('#doctorname_point').addClass('reg_tip_no').show().children('ul').html('4-14位字母、数字或下划线');

                        return fale = false;

                    }

                }

            });

            return fale;

        },

        //密码检测

        check_doctorpassword: function (){

            var fale = true;

            var password=$.trim($('#doctorpassword').val());

            if($.trim(password) == ''){

                $('#doctorpassword_point').addClass('reg_tip_no').show().children('ul').html('密码不能为空');

                return fale = false;

            }

            if(!(/^[0-9a-zA-Z_]+$/).test(password)){

                $('#doctorpassword_point').addClass('reg_tip_no').show().children('ul').html('限用英文字母、数字和下划线');

                return fale = false;

            }

            //密码由6-16位字母、数字或下划线组成

            if(!password.match(/^[\w]{6,16}$/)){

                $('#doctorpassword_point').addClass('reg_tip_no').show().children('ul').html('密码由6-16位字符组成');

                return fale = false;

            }

            $('#doctorpassword_point').removeClass('reg_tip_no').addClass('reg_tip_yes').show().children('ul').hide();



            return fale;

        },

        //手机号码检测

        check_doctormobile: function (){

            var fale = true;

            var mobile = $.trim($('#doctormobile').val());

            var check_mobile = /^1[3|4|5|8|9|7][\d]{9}$/;

            if(mobile !=''){

                if(!check_mobile.exec(mobile)){

                    $('#doctormobile_point').addClass('reg_tip_no').show().children('ul').html('手机号码格式不正确');

                    return fale = false;

                }

                $('#doctormobile_point').removeClass('reg_tip_no').hide();

            }else{

                $('#doctormobile_point').addClass('reg_tip_no').show().children('ul').html('请输入手机号');

                return fale = false;

            }

            return fale;

        },

        //用户名推荐

        username_recommend:function(username){

            if(username ==''){

                return false;

            }

            var username_recommend_html = '';

            var url = '/public/usernamerecommend';

            $.ajax({type:'post',url:url,dataType:'json',async:false,

                data:{username:username},

                success: function(json){

                    if(json.errno == 0 ){

                        username_recommend_html = '<ol>选择推荐用户名：<img id="closedoctor" title="关闭" src="images/close03.gif"></ol>';

                        $.each(json.username_list, function(index, val) {

                            username_recommend_html+='<ul><input class="doctorname_recommend" value="'+val+'" type="radio" name="username_recommend">'+val+'</ul>';

                        });

                    }

                }

            });

            return username_recommend_html;

        },

        check_doctorclause:function(){

            var fale = true;

            if(!$("#doctorclause").prop("checked")){

                if(confirm("是否接受飞华健康网《网站隐私保护条款》?")){

                    $("#doctorclause").prop('checked',true);

                } else {

                    return fale = false;

                }

            }

            return fale;

        },

        reg_submit:function(){

            var check_result = true;

            var check_error = [];

            check_error[0] = doctorreg_check.check_doctorname();

            check_error[1] = doctorreg_check.check_doctorpassword();

            check_error[2] = doctorreg_check.check_doctormobile();

            check_error[3] = doctorreg_check.check_doctorclause();

            for(var i in check_error){

                if(!check_error[i]){

                    check_result = false;

                }

            }

            if(check_result){

                var url = '/user/checkrecommreg';

                var username = $.trim($("#doctorname").val());

                var password = $.trim($("#doctorpassword").val());

                var mobile = $.trim($("#doctormobile").val());

                var code = $.trim($("#doctorcode").val());

                var recommenduid=$.trim($("#recommenduid").val());

                var recommendtype=$.trim($("#recommendtype").val())



                var sendData={username:username,password:password,mobile:mobile,code:code,recommenduid:recommenduid,recommendtype:recommendtype};

                $.ajax({

                    type:'post',

                    url:url,

                    dataType:'json',

                    async:false,

                    data:sendData,

                    complete: function(){

                        $("#doctorreg_submit").attr('disabled',false);

                    },

                    beforeSend: function(){

                        $("#doctorreg_submit").attr('disabled','disabled');

                    },

                    success: function(json){

                        if(json.errno == 0 ){

                            location.href = '/user/doctorinfo';

                        }else if(json.errno == 10207){

                            $('#doctor_mobile_points').addClass('reg_tip_no').show().children('ul').html('手机验证码不正确');

                            return false;

                        }else if(json.errno == 10210){

                            $('#doctormobile_point').addClass('reg_tip_no').show().children('ul').html('手机号码错误');

                            return false;

                        }else if(json.errno == 10205){

                            $('#doctorpassword_point').addClass('reg_tip_no').show().children('ul').html('密码输入有误');

                            return false;

                        }else if(json.errno == 10200){

                            $('#doctormobile_point').addClass('reg_tip_no').show().children('ul').html('手机号码已存在');

                            return false;

                        }else if(json.errno == 10204){

                            $('#doctorname_point').addClass('reg_tip_no').show().children('ul').html('用户名由4-14位字母、数字或下划线组成');

                            return false;

                        }else if(json.errno==10237){

                            $('#doctorname_point').addClass('reg_tip_no').show().children('ul').html('推荐人错误！');

                            return fale = false;

                        }else {

                            alert('网络延时，请稍后再试');

                            return false;

                        }

                    }

                });

            }

        }

    }

    doctorreg_check.init();



    $(function(){



        var currTab="";

        if (currTab==1) {

            $("#doctorTab").addClass("curr").siblings().removeClass("curr");

            $(".regContent").hide();

            $("#doctorReg").show();

        };



        $(".regTab").click(function(){

            $(this).addClass("curr").siblings().removeClass("curr");

            var linked=$(this).attr("linked");

            $(".regContent").hide();

            $("#"+linked).show();

        })



        $("#code").focus(function(){

            $("#mobile_points").css("display","none");

        });



        $('#send_mobile').click(function(){

            var mobile =  $('#mobile').val();

            if($.trim(mobile) == ''){

                $('#mobile_point').addClass('reg_tip_no').show().children('ul').show().html('请填写接收短信的手机号码');

                return false;

            }

            var check_mobile = /^1[3|4|5|8|9|7][\d]{9}$/;

            if(!check_mobile.exec(mobile)){

                $('#mobile_point').addClass('reg_tip_no').show().children('ul').show().html('手机号码格式不正确');

                return false;

            }

            changeVerify();//验证码换一换

            $("#overlay_verify,#wrapper").show();//显示弹出层

        });



        $('#doctor_send_mobile').click(function(){

            var mobile =  $('#doctormobile').val();

            if($.trim(mobile) == ''){

                $('#doctormobile_point').addClass('reg_tip_no').show().children('ul').show().html('请填写接收短信的手机号码');

                return false;

            }

            var check_mobile = /^1[3|4|5|8|9|7][\d]{9}$/;

            if(!check_mobile.exec(mobile)){

                $('#doctormobile_point').addClass('reg_tip_no').show().children('ul').show().html('手机号码格式不正确');

                return false;

            }

            changeVerify();//验证码换一换

            $("#overlay_verify,#wrapper").show();//显示弹出层

        });

        //短信验证码，点击确定，发送短信

        $("#submit_verify").click(function(){

            if($("#doctorTab").hasClass("curr")){

                sendMessageToDoctor();

            }else{

                sendMessage();//发送短信

            }

        });

    })



    //发送短信

    function sendMessage(){

        var verify_code = $.trim($('#inputy_verify').val());//输入的验证码

        var mobile = $('#mobile').val();

        var url = '/user/sendmobile';

        closeWindow();//取消(关闭弹层)

        $.ajax({type:'post',url:url,dataType:'json',async:false,

            data:{mobile:mobile,act:"user_reg",verify_code : verify_code},

            complete: function(){

                $("#send_mobile").attr('disabled',false);

            },

            beforeSend: function(){

                $("#send_mobile").hide();

                $("#send_mobile").attr('disabled','disabled');

                $("#show_time").show().html('加载中...');

            },

            success: function(json){

                if(json.errno == 0){

                    $('#mobile_point').removeClass('reg_tip_no').addClass('reg_tip_yes').show().children('ul').show().html('发送成功');

                    $("#send_mobile").hide();

                    $("#show_time").show();

                    //隐藏验证码一栏

                    $("dl.reg02a1").addClass("removed").hide();



                    timer = setInterval(timeChange,1000);

                    return false;

                }else if(json.errno == 10200){

                    $('#mobile_point').addClass('reg_tip_no').show().children('ul').show().html('手机号码已存在');

                    $("#send_mobile").show();

                    $("#show_time").hide();

                    return false;

                }else if(json.errno == 10210){

                    $('#mobile_point').addClass('reg_tip_no').show().children('ul').show().html('手机号码错误');

                    $("#send_mobile").show();

                    $("#show_time").hide();

                    return false;

                }else if(json.errno == 10500){

                    $('#mobile_point').addClass('reg_tip_no').show().children('ul').show().html('短信发送频率过快，请稍后发送！');

                    $("#send_mobile").show();

                    $("#show_time").hide();

                    return false;

                }else if(json.errno == 10502){

                    $('#mobile_point').addClass('reg_tip_no').show().children('ul').show().html('您今天发送的验证次数已达到上限');

                    $("#send_mobile").show();

                    $("#show_time").hide();

                    return false;

                }

            }

        });

    }



    //医生发送短信

    function sendMessageToDoctor(){

        var verify_code = $.trim($('#inputy_verify').val());//输入的验证码

        var mobile = $('#doctormobile').val();

        var url = '/user/sendmobile';

        closeWindow();//取消(关闭弹层)

        $.ajax({type:'post',url:url,dataType:'json',async:false,

            data:{mobile:mobile,act:"user_reg",verify_code : verify_code},

            complete: function(){

                $("#doctor_send_mobile").attr('disabled',false);

            },

            beforeSend: function(){

                $("#doctor_send_mobile").hide();

                $("#doctor_send_mobile").attr('disabled','disabled');

                $("#doctor_show_time").show().html('加载中...');

            },

            success: function(json){

                if(json.errno == 0){

                    $('#doctormobile_point').removeClass('reg_tip_no').addClass('reg_tip_yes').show().children('ul').show().html('发送成功');

                    $("#doctor_send_mobile").hide();

                    $("#doctor_show_time").show();

                    //隐藏验证码一栏

                    $("dl.reg02a1").addClass("removed").hide();



                    timer = setInterval(doctortimeChange,1000);

                    return false;

                }else if(json.errno == 10200){

                    $('#doctormobile_point').addClass('reg_tip_no').show().children('ul').show().html('手机号码已存在');

                    $("#doctor_send_mobile").show();

                    $("#doctor_show_time").hide();

                    return false;

                }else if(json.errno == 10210){

                    $('#doctormobile_point').addClass('reg_tip_no').show().children('ul').show().html('手机号码错误');

                    $("#doctor_send_mobile").show();

                    $("#doctor_show_time").hide();

                    return false;

                }else if(json.errno == 10500){

                    $('#doctormobile_point').addClass('reg_tip_no').show().children('ul').show().html('短信发送频率过快，请稍后发送！');

                    $("#doctor_send_mobile").show();

                    $("#doctor_show_time").hide();

                    return false;

                }else if(json.errno == 10502){

                    $('#doctormobile_point').addClass('reg_tip_no').show().children('ul').show().html('您今天发送的验证次数已达到上限');

                    $("#doctor_send_mobile").show();

                    $("#doctor_show_time").hide();

                    return false;

                }

            }

        });

    }



    var timeTotle=120;

    var doctorTimeTotal = 120;

    function timeChange(){

        if(timeTotle==0){

            clearInterval(timer);

            timeTotle = 120;

            $("#send_mobile").show();

            $("#show_time").hide();

        }

        $('#show_time').html(timeTotle+'秒') ;

        timeTotle = timeTotle-1;

    }

    function doctortimeChange(){

        if(doctorTimeTotal==0){

            clearInterval(timer);

            doctorTimeTotal = 120;

            $("#doctor_send_mobile").show();

            $("#doctor_show_time").hide();

        }

        $('#doctor_show_time').html(doctorTimeTotal+'秒') ;

        doctorTimeTotal = doctorTimeTotal-1;

    }

</script>

<script type="text/javascript">

    /*<![CDATA[*/

    jQuery(function($) {

        jQuery('#yw0').after("<a class='link01' onfocus=\"this.blur();\" id=\"yw0_button\" href=\"\/user\/captcha?refresh=1\">\u6362\u4e00\u5f20<\/a>");

        jQuery(document).on('click', '#yw0_button', function(){

            jQuery('#yw0').attr('src', '/user/captcha?v='+Date.parse(new Date()));

            return false;

        });

    });

    /*]]>*/

</script>



